package com.wtwd.campus.receiver;

import com.wtwd.campus.entity.MqGeneralSwitchResult;
import com.wtwd.campus.service.InjectFeignService;

/**
 * @author mjy
 * @date 2022/12/15
 * @description
 */
public class SetAppInstallationReceiver implements Receiver {

  /*  *TJ,IMEI,APPDOWNLOAD,seq,switch#*/

    @Override
    public String parseMessage(String data) {
        String[] split = data.split(",");
        String imei = split[1];
        String commandNumber = split[3];
        String flag = split[4];
        String date = split[5];//年月日
        String deviceStatus = split[6];//设备状态
        MqGeneralSwitchResult mqGeneralSwitchResult = new MqGeneralSwitchResult();
        mqGeneralSwitchResult.setImei(imei);
        mqGeneralSwitchResult.setDeviceTime(commandNumber);
        mqGeneralSwitchResult.setDeviceDate(date);
        mqGeneralSwitchResult.setCommandNumber(commandNumber);
        mqGeneralSwitchResult.setResult(Integer.parseInt(flag));
        mqGeneralSwitchResult.setDeviceStatus(deviceStatus);
        InjectFeignService.getIrmFeignClientService().setAppInstallationReceiver(mqGeneralSwitchResult);
        return imei;
    }
}
